/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author niit
 */
@Entity
@Table(name = "fl_message")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FlMessage.findAll", query = "SELECT f FROM FlMessage f"),
    @NamedQuery(name = "FlMessage.findByMessageid", query = "SELECT f FROM FlMessage f WHERE f.messageid = :messageid"),
    @NamedQuery(name = "FlMessage.findByMessage", query = "SELECT f FROM FlMessage f WHERE f.message = :message")})
public class FlMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "messageid")
    private Integer messageid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1000)
    @Column(name = "message")
    private String message;
    @JoinColumn(name = "adminid", referencedColumnName = "adminid")
    @ManyToOne(optional = false)
    private FlAdmin adminid;

    public FlMessage() {
    }

    public FlMessage(Integer messageid) {
        this.messageid = messageid;
    }

    public FlMessage(Integer messageid, String message) {
        this.messageid = messageid;
        this.message = message;
    }

    public Integer getMessageid() {
        return messageid;
    }

    public void setMessageid(Integer messageid) {
        this.messageid = messageid;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public FlAdmin getAdminid() {
        return adminid;
    }

    public void setAdminid(FlAdmin adminid) {
        this.adminid = adminid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (messageid != null ? messageid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FlMessage)) {
            return false;
        }
        FlMessage other = (FlMessage) object;
        if ((this.messageid == null && other.messageid != null) || (this.messageid != null && !this.messageid.equals(other.messageid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.FlMessage[ messageid=" + messageid + " ]";
    }
    
}
